$(document).keydown(function(event)
		{
	  if(event.keyCode==13){
		  searchBook();
	  }
  
    
		});


function searchBook(){
    
    var url="book";
    var params={keyWord:$("#search").val()};

    $.post(
        url,
        params,
        function process(data){
        	var book;
        	if(data.length!=0)
        	   book='<hr/>';
        	else
        		book='<h3>对不起，暂时没收录与该关键词相关的图书</h3>';
        	for(var i=0;i<data.length;i++){
        		var url=data[i].url;
        		var title=data[i].title;
        		book=book
        			+'<a href=\"http://localhost:8080/book/test/read.action?url='+url+'\">'
        			+title
        			+'</a>'
        			+'<hr/>'
        	}

        	$('#bookname').html(book);
        	$("#content")[0].style.display="block"
        	
/*            url1=data[0].url;
            title1=data[0].title;
            url2=data[1].url;
            title2=data[1].title;
          
            $("#book1").attr("href","http://localhost:8080/book/test/read.action?url="+url1);
            $("#book1").text(title1);
            $("#book2").attr("href","http://localhost:8080/book/test/read.action?url="+url2);
            $("#book2").text(title2);
            
            $("#content")[0].style.display="block";*/
            
        },
        "json"
    );

}
  
